<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



<!DOCTYPE html>
<!--[if IE 6 ]> <html class="ie6 lte_ie6 lte_ie7 lte_ie8 lte_ie9"> <![endif]-->
<!--[if lte IE 6 ]> <html class="lte_ie6 lte_ie7 lte_ie8 lte_ie9"> <![endif]-->
<!--[if lte IE 7 ]> <html class="lte_ie7 lte_ie8 lte_ie9"> <![endif]-->
<!--[if lte IE 8 ]> <html class="lte_ie8 lte_ie9"> <![endif]-->
<!--[if lte IE 9 ]> <html class="lte_ie9"> <![endif]-->
<!--[if (gte IE 10)|!(IE)]><!--><html><!--<![endif]-->
<head>
    <title>新建员工复职信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">

    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
    <script type="text/javascript" src="/js/news/jquery-1.9.1.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/news/page.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/ueditor/UEcontroller.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>

    <script type="text/javascript" >
        var MYOA_JS_SERVER = "";
        var MYOA_STATIC_SERVER = "";
    </script>

    <style>

        body{
            font-size: 15px;
            font-family: 微软雅黑;
        }

        .TableBlock .TableData td, .TableBlock td.TableData {
            background: #FFFFFF;
            border-bottom: none;
            border-right: none;
            padding: 3px;
        }
        .big3{
            margin-left: 5px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            margin-top: -3px;
            margin-right: 40px;
            font-size: 22px;
            color: #494d59;
            font-weight: inherit;
        }


        .btn_ .btn_style {
            background: url("../../img/save.png") no-repeat;
        }
        #rs {
            display: inline-block;
            float: left;
            width: 66px;
            height: 30px;
            text-align: center;
            margin-top: 10px;
            margin-bottom: 20px;
            padding-left: 23px;
            padding-top: 7px;
            cursor: pointer;
            font-size: 14px;
            background: url("../../img/publish.png") no-repeat;
            margin-left: 40%;
        }
        .TableData{
            font-size: 14px;
            color: #2a588c;
            /*   font-weight: bold;*/
        }
        .TableBlock tbody tr{
            height: 52px;
        }
        .TableBlock tbody tr td{
            border: 1px solid #c0c0c0;
        }
        .TableBlock{
            border: 1px #124164 solid;
        }


        .TableBlock tr td:first-of-type,table tr td:nth-child(3){
            text-align: right;
        }
        .div_1{
            margin-left: 20px;
        }
        .newClass{
            position:absolute;
            top:0;
            right:0;
            width: 90px;
            height: 28px;
            background: url(../../img/file/cabinet01.png) no-repeat;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin: 2% 3% 0 0;
            cursor: pointer;
        }
        .bar {
            height: 18px;
            background: green;
        }
    </style>
</head>


<script type="text/javascript">

</script>

<body class="bodycolor" topmargin="5">
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
    <tr>
        <td>
            <div class="div_1">
                <img src="/img/commonTheme/${sessionScope.InterfaceModel}/notify_new.png" align="absmiddle"><span class="big3" id="title_info">新建员工复职信息</span>&nbsp;&nbsp;
            </div>
            <div class="newClass" id="turn">

            <span style="margin-left: 30px;">
                <%--<img style="margin-right: 4px;margin-left: -11px;margin-bottom: -2px;" src="../../img/mywork/newbuildworjk.png" alt="">--%>
                返回
            </span>
            </div>
        </td>
    </tr>
</table>
<br>
<form enctype="multipart/form-data" action=""  method="post" id="form1" name="form1" onSubmit="return CheckForm();">
    <table class="TableBlock" width="80%" align="center">

        <tr>
            <td nowrap class="TableData">复职人员：</td>
            <td width="80%" style="text-align: left">
                <textarea name="" class="theControlData" readonly="readonly" id="personnel" style="width: 165px;" rows="2"></textarea>
                <a style="margin-left:5px;" href="javascript:;" class="addControls" data-type="3"><fmt:message code="global.lang.add"/></a>
                <a href="javascript:;" style="color: red" class="cleardate"><fmt:message code="global.lang.empty"/></a>

            </td>
            <td nowrap class="TableData">复职类型：</td>
            <td class="TableData">
                <select name="reappointmentType" id="rehabType" style="background: white; width:170px;height: 28px;" title="">

                </select>
            </td>
        </tr>

        <tr>
            <td nowrap class="TableData">申请日期：</td>
            <td class="TableData">
                <input type="text" id="applicationDate" style="width: 158px;height:28px;" name="transferDate" size="12" maxlength="10" class="BigInput" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                <span style="color:red">*</span>
            </td>

            <td nowrap class="TableData">担任职务：</td>
            <td class="TableData">
                <input type="text" id="nowPosition" style="width: 165px;height:28px;" name="transferEffectiveDate">
                <span style="color:red">*</span>
            </td>
        </tr>

        <tr>
            <td nowrap class="TableData">拟复职日期：</td>
            <td class="TableData">
                <input type="text" id="reappointmentTimePlan" style="width: 158px;height:28px;" name="transferDate" size="12" maxlength="10" class="BigInput" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                <span style="color:red">*</span>
            </td>
            <td nowrap class="TableData">实际复职日期：</td>
            <td class="TableData">
                <input type="text" id="reappointmentTimeFact" style="width: 158px;height:28px;" name="transferDate" size="12" maxlength="10" class="BigInput" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                <span style="color:red">*</span>
            </td>
        </tr>

        <tr>
            <td nowrap class="TableData">工资恢复日期：</td>
            <td class="TableData">
                <input type="text" id="firstSalaryTime" style="width: 158px;height:28px;" name="transferDate" size="12" maxlength="10" class="BigInput" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                <span style="color:red">*</span>
            </td>
            <td nowrap class="TableData">复职部门：</td>
            <td width="70%">
                <%--<td width="80%" style="text-align: left">
                 <textarea name="" class="theControlData" readonly="readonly" id="department" cols="30" rows="2"></textarea>
                 <a href="javascript:;" class="addControls" data-type="1"><fmt:message code="global.lang.add"/></a>
                 <a href="javascript:;" class="cleardate"><fmt:message code="global.lang.empty"/></a>
                 <input type="hidden" name="toId">
             </td>--%>
                    <input disabled type="text" id="department" style="height:28px"></span>
                    <span class="btn adddept" style="color:#0066cc;cursor: pointer">添加</span>
                    <span class="btn clear" style="color: red;cursor: pointer">清除</span>
            </td>
        </tr>

        <tr>
            <td nowrap class="TableData">复职手续办理：</td><%--备注--%>
            <td class="TableData" colspan=3>
                <textarea name="materialsCondition" id="materialsCondition" cols="84" rows="4" class="BigInput" value=""></textarea>
            </td>
        </tr>
        <tr>
            <td nowrap class="TableData">备注：</td><%--备注--%>
            <td class="TableData" colspan=3>
                <textarea name="remark" id="remark" cols="84" rows="3" class="BigInput" value=""></textarea>
            </td>
        </tr>
        <tr>
            <td nowrap class="TableData">附件：</td><%--备注--%>
            <td class="TableData" id="files_txt" colspan=3>
                <%--<textarea name="remark" id="remark" cols="84" rows="3" class="BigInput" value=""></textarea>--%>
            </td>
        </tr>
        <tr>
            <td nowrap class="TableData">附件上传：</td>
            <td colspan=3>
                <div id="query_uploadArr" style="margin-bottom: 5px;"></div>
                <div style="float: left;margin-right: 10px;"><img style="margin-left: 9px;margin-top: 3px;" src="/img/mg11.png" alt=""/></div>
                <div style="float: left;">
                    <form id="uploadimgform" target="uploadiframe" action="/upload?module=sdas"
                          enctype="multipart/form-data" method="post" style="position: relative">
                        <input type="file" name="file" multiple="multiple" id="uploadinputimg" class="w-icon5"
                               style="position: absolute;opacity: 0;width: 70px;z-index: -1;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0)">
                        <a id="uploadimg" style="font-size:16px; cursor: pointer;"><fmt:message code="notice.th.addfile"/></a>
                    </form>
                </div>
                <div id="progress" style="width: 200px;float: left;margin-left: 10px;margin-top: 2px;">
                    <div class="bar" style="width: 0%;"></div>
                </div>
                <div class="barText" style="float: left;margin-left: 10px;"></div>
            </td>
        </tr>


        <tr>
            <td colspan="4" style="text-align: left">
                复职说明：
                <div  id="word_container" name="incentiveDescription">

                </div>
            </td>
        </tr>

        <tr align="center" class="TableControl">
            <td colspan=4 nowrap>
                <div id="rs" type="save" class="btn_style btn_ok"><fmt:message code="global.lang.save" /></div><%--保存--%>
            </td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    var type = $.GetRequest().type;
    var userId= decodeURI($.GetRequest().userId);

    $.ajax({
        type:'get',
        url:'/hr/manage/fuZhiList?parentNo=HR_STAFF_REINSTATEMENT',
        dataType:'json',
        success:function(res){
            var str='';
            if(res){
                $.each(res.obj,function(index,item){
                    str+='<option value="'+item.codeName+'">'+item.codeName+'</option>'
                });
                $('#rehabType').append(str);
            }
        }
    });
    $('.adddept').click(function(){
        dept_id='department';
        $.popWindow("../../common/selectDept?0");
    })
    $('.clear').click(function(){
        $('#department').val('')
        $('#department').removeAttr('deptId')
        $(this).siblings().find('input').removeAttr('deptname').removeAttr('deptno').removeAttr('deptid').val('')
    })

    $('.addControls').click(function () {
        user_id='personnel';
        $.popWindow("/common/selectUser?0");
    })
    $('.cleardate').click(function () {
        $('#personnel').attr('username','');
        $('#personnel').attr('dataid','');
        $('#personnel').attr('user_id','');
        $('#personnel').attr('userprivname','');
        $('#personnel').val('');
    })
    $("#turn").click(function () {

        if(type!=undefined){
            window.location.href = "/hr/manage/rehabManage?type=1&userId="+userId;
        }else{
            window.location.href = "/hr/manage/rehabManage";
        }

    })
    var transferId=GetQueryString('transferId');
    ue = UE.getEditor('word_container',{elementPathEnabled : false});
    UEimgfuc();
    var user_id;
    var depart_id;
    //时间控件调用
    var start = {
        format: 'YYYY-MM-DD',
        /* min: laydate.now(), //设定最小日期为当前日期*/
        /* max: '2099-06-16 23:59:59', //最大日期*/
        istime: true,
        istoday: false,
        choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        format: 'YYYY-MM-DD',
        /*min: laydate.now(),*/
        /*max: '2099-06-16 23:59:59',*/
        istime: true,
        istoday: false,
        choose: function(datas){
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };

    function selectNumber(name,val){
        var numbers = $("select[name="+name+"]").find("option"); //获取select下拉框的所有值
        console.log(numbers.length)

        for (var j = 1; j < numbers.length; j++) {
            if ($(numbers[j]).val() == val) {
                $(numbers[j]).attr("selected", "selected");
            }
        }
    }


    function getRequest() {
        var url = window.location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i < strs.length; i ++) {

                theRequest[strs[i].split("=")[0]]=decodeURI(strs[i].split("=")[1]);

            }
        }
        return theRequest;
    }

    $(function () {
        var id= getRequest().id;
        console.log(id);
        if(id!= '' &&  id!= undefined){
            $('#title_info').html('修改员工复职信息');
                $.ajax({
                    url: "/hr/manage/selRehabById",
                    type: "get",
                    data: {
                        reinstatementId: id
                    },
                    dataType: 'json',
                    success: function (obj) {
                        console.log(obj)
                        var datas = obj.object;
                            //复职人员
                            $("#personnel").val(datas.reinstatementPerson),
                            //复职类型
                            $("#rehabType").val(datas.reappointmentType),
                            //申请日期
                            $("#applicationDate").val(datas.applicationDate),
                            //担任职务
                            $("#nowPosition").val(datas.nowPosition),
                            //拟恢复日期
                           $("#reappointmentTimePlan").val(datas.reappointmentTimePlan),
                            //实际恢复日期
                            $("#reappointmentTimeFact").val(datas.reappointmentTimeFact),
                            //工资回复日期
                            $("#firstSalaryTime").val(datas.firstSalaryTime),
                            //复职部门
                           $('#department').val(datas.reappointmentTypeStr+','),
                                $('#department').attr('deptid',datas.reappointmentDept),
                            //复职手续办理
                            $("#materialsCondition").val(datas.materialsCondition),
                            //备注
                            $('#remark').val(datas.remark),
                            //复职说明
                            ue.setContent(datas.reappointmentState);


                        var str = '';
                        var arrList = datas.attachmentList;

                        if (arrList.length > 0) {
                            console.log(1)
                            for (var i = 0; i < arrList.length; i++) {
                                str += '<div class="dech" deUrl="' + encodeURI(arrList[i].attUrl) + '">' +
                                    '<a href="<%=basePath %>download?' + encodeURI(arrList[i].attUrl) + '" NAME="' + arrList[i].attachName + '*" style="text-decoration:none;">' +
                                    '<img style="margin-right:10px;" src="/img/attachment_icon.png"/>' + arrList[i].attachName + '</a>' +
                                    '<img class="deImgs" style="margin-left:5px;cursor: pointer;" src="/img/file/icon_deletecha_03.png"/>' +
                                    '<input type="hidden" class="inHidden" value="' + arrList[i].aid + '@' + arrList[i].ym + '_' + arrList[i].attachId + ',">' +
                                    '</div>';
                            }
                            $('#files_txt').append(str);
                        }
                    }
                });

            $('#rs').attr('type','edit')
        }else{
            if(type!=undefined){
                $('#personnel').val(parent.userName+',');
                $('#personnel').attr('user_id',userId+',');
                $('#personnel').attr('dataId',userId+',');
                $('#personnel').attr('userName',parent.userName+',');
            }
        }
        function CheckForm(){
            if($('#planNo').val()==''){
                layer.msg('<fmt:message  code="event.th.PlanNull"/>',{icon:2});
                return false;
            }
            if($('#planName').val()==''){
                layer.msg('<fmt:message  code="event.th.PlanEmpty"/>',{icon:2});
                return false;
            }
            if($('#assessingOfficer').val()==''){ //审批人不能为空
                layer.msg('<fmt:message  code="withdraw.th.shenpi"/>',{icon:2});
                return false;
            }
            if($('#applicationDate').val()==''){
                layer.msg('申请日期不能为空',{icon:2});
                return false;
            }
            if($('#applicationDate').val()==''){
                layer.msg('申请日期不能为空',{icon:2});
                return false;
            }
            if($('#nowPosition').val()==''){
                layer.msg('担任职务不能为空',{icon:2});
                return false;
            }
            if($('#reappointmentTimePlan').val()==''){
                layer.msg('拟复职日期不能为空',{icon:2});
                return false;
            }
            if($('#reappointmentTimeFact').val()==''){
                layer.msg('实际复职日期不能为空',{icon:2});
                return false;
            }
            if($('#firstSalaryTime').val()==''){
                layer.msg('工资恢复日期不能为空',{icon:2});
                return false;
            }
            if($('#department').val()==''){
                layer.msg('复职部门不能为空',{icon:2});
                return false;
            }
            return true;
        }

        $('#uploadimg').click(function(){
            me =this;
            $('#form1').attr('action','/upload?module=sdas')
            $('#uploadinputimg').click()
        })

        $('#uploadinputimg').fileupload({
            dataType:'json',
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .bar').css(
                    'width',
                    progress + '%'
                );
                $('.barText').html(progress + '%');
                if(progress >= 100){  //判断滚动条到100%清除定时器
                    timer=setTimeout(function () {
                        $('#progress .bar').css(
                            'width',
                            0 + '%'
                        );
                        $('.barText').html('');
                    },2000);

                }
            },
            done: function (e, data) {
                if(data.result.obj != ''){
                    var data = data.result.obj;
                    var str = '';
                    var str1 = '';
                    for (var i = 0; i < data.length; i++) {
                        str+='<div class="dech" deUrl="'+encodeURI(data[i].attUrl)+'" style="display:block;"><a class="ATTACH_a" NAME="'+data[i].attachName+'*" href="<%=basePath %>download?'+encodeURI(data[i].attUrl)+'">'+data[i].attachName+'</a><img class="deImgs" style="margin-left:5px;cursor: pointer;" src="/img/file/icon_deletecha_03.png"/><input type="hidden" NAME="'+data[i].attachName+'*"  class="inHidden" value="'+data[i].aid+'@'+data[i].ym+'_'+data[i].attachId+',"></div>';
                    }
                    $('#files_txt').append(str);
                }else{
                    //alert('添加附件大小不能为空!');
                    layer.alert('添加附件大小不能为空!',{},function(){
                        layer.closeAll();
                    });
                }
            }
        });

        $('#files_txt').on('click','.deImgs',function(){
            var data=$(this).parents('.dech').attr('deUrl');
            var dome=$(this).parents('.dech');
            deleteChatment(data,dome);
        })

        //删除附件
        function deleteChatment(data,element){

            layer.confirm('<fmt:message code="menuSSetting.th.isdeleteMenu" />？', {/*确定要删除吗*/
                btn: ['<fmt:message code="global.lang.ok" />','<fmt:message code="depatement.th.quxiao" />'], //按钮 /* 确定  取消*/
                title:'<fmt:message code="notice.th.DeleteAttachment" />'/*删除附件*/
            }, function(){
                //确定删除，调接口
                $.ajax({
                    type:'get',
                    url:'/delete',
                    dataType:'json',
                    data:data,
                    success:function(res){

                        if(res.flag == true){
                            layer.msg('<fmt:message code="workflow.th.delsucess" />', { icon:6});/*删除成功*/
                            element.remove();
                        }else{
                            layer.msg('<fmt:message code="lang.th.deleSucess" />', { icon:6});/*删除失败*/
                        }
                    }
                });

            }, function(){
                layer.closeAll();
            });
        }

        // 提交表单
        $("#rs").click(function(){
            var id= getRequest().id;
            var html = ue.getContent();
            $('#form1').attr('action','')
            var fileId=''
            var fileName=''
            if(CheckForm())
            {
                for(var i=0;i<$('.inHidden').length;i++){
                    fileId += $('.inHidden').eq(i).val();
                    fileName += $('.inHidden').eq(i).attr('name');
                }
                var data = {
                    //附件
                    "attachmentId":fileId,
                    "attachmentName":fileName,
                    //复职人员
                    reinstatementPerson:$("#personnel").attr('user_id'),
                    //复职类型
                    reappointmentType:$("#rehabType").find("option:selected").text(),
                    //申请日期
                    applicationDate:$("#applicationDate").val(),
                    //担任职务
                    nowPosition:$("#nowPosition").val(),
                    //拟恢复日期
                    reappointmentTimePlan:$("#reappointmentTimePlan").val(),
                    //实际恢复日期
                    reappointmentTimeFact:$("#reappointmentTimeFact").val(),
                    //工资回复日期
                    firstSalaryTime:$("#firstSalaryTime").val(),
                    //复职部门
                    reappointmentDept:$('#department').attr('deptid'),
                    //复职手续办理
                    materialsCondition:$("#materialsCondition").val(),
                    //备注
                    remark:$('#remark').val(),
                    //复职说明
                    reappointmentState:html,
                    reinstatementId:id

                }

                var tp = $('#rs').attr('type')
                if(tp == 'save') {
                    var id= getRequest().id;
                    $.ajax({
                        type: 'post',
                        url: '/hr/manage/addRehab',
                        dataType: 'json',
                        data:{
                            //附件
                            "attachmentId":fileId,
                            "attachmentName":fileName,
                            //复职人员
                            reinstatementPerson:$("#personnel").attr('user_id'),
                            //复职类型
                            reappointmentType:$("#rehabType").find("option:selected").text(),
                            //申请日期
                            applicationDate:$("#applicationDate").val(),
                            //担任职务
                            nowPosition:$("#nowPosition").val(),
                            //拟恢复日期
                            reappointmentTimePlan:$("#reappointmentTimePlan").val(),
                            //实际恢复日期
                            reappointmentTimeFact:$("#reappointmentTimeFact").val(),
                            //工资回复日期
                            firstSalaryTime:$("#firstSalaryTime").val(),
                            //复职部门
                            reappointmentDept:$('#department').attr('deptid'),
                            //复职手续办理
                            materialsCondition:$("#materialsCondition").val(),
                            //备注
                            remark:$('#remark').val(),
                            //复职说明
                            reappointmentState:html,
                            reinstatementId:id
                        },
                        success: function (rsp) {
                            if (rsp.flag == true) {
                                layer.msg('<fmt:message code="url.th.addSuccess" />', {icon: 1});
                                /*添加成功*/
//                                parent.location.href = '/hr/manage/rehabManage';

                                if(type!=undefined){
                                    window.location.href = "/hr/manage/rehabManage?type=1&userId="+userId;
                                }else{
                                    window.location.href = "/hr/manage/rehabManage";
                                }
                            } else {
                                layer.msg('<fmt:message code="hr.th.AddFailed" />', {icon: 2});
                                /*添加失败*/
                            }
                        }
                    })
                } else {

                    $.ajax({
                        type: 'post',
                        url: '/hr/manage/modifyRehab',
                        dataType: 'json',
                        data: data,
                        success: function (rsp) {
                            if (rsp.flag == true) {
                                layer.msg('修改成功', {icon: 1});
                                /*添加成功*/
                                if(type!=undefined){
                                    window.location.href = "/hr/manage/rehabManage?type=1&userId="+userId;
                                }else{
                                    window.location.href = "/hr/manage/rehabManage";
                                }

                            } else {
                                layer.msg('修改失败', {icon: 2});
                                /*添加失败*/
                            }
                        }
                    })
                }

            }
        });
    //部门
       $('.newBtnone').click(function () {
            dept_id='tranDeptBefore'
            $.popWindow("/common/selectDept");
        })
        $('.clearData').click(function(){
            $("#tranDeptBefore").attr("deptname","");
            $("#tranDeptBefore").attr("deptid","");
            $("#tranDeptBefore").val("");
        })
        //调动后部门
        $('.newBtnone_hou').click(function () {
            dept_id='tranDeptAfter'
            $.popWindow("/common/selectDept");
        })
        $('.clearData_hou').click(function(){
            $("#tranDeptAfter").attr("deptname","");
            $("#tranDeptAfter").attr("deptid","");
            $("#tranDeptAfter").val("");
        })
        //人员
        //选择部门
        $('#departAdd').click(function(){
            user_id="transferPerson";
            $.popWindow("/common/selectUser?0");
        })

    });

    // 用正则表达式获取地址栏参数
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);

        if(r!=null) {
            return  unescape(r[2]);
        } else {
            return null;
        }
    }
</script>
</body>
</html>

